<?php if ($this->_var['full_page']): ?>
<!-- $Id: users_list.htm 17053 2010-03-15 06:50:26Z sxc_shop $ -->
<?php echo $this->fetch('pageheader.htm'); ?>
<?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,listtable.js')); ?>

<div class="form-div">
  <form action="javascript:searchUser()" name="searchForm">
    <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />&nbsp; 
      <select name="user_rank" style="display: none;">
        <option value="0"><?php echo $this->_var['lang']['all_option']; ?></option>
        <?php echo $this->html_options(array('options'=>$this->_var['user_ranks'])); ?>
      </select>
    &nbsp;&nbsp;
    <input type="text" name="pay_points_gt" size="8" style="display: none;" />&nbsp;&nbsp;
    <input type="text" name="pay_points_lt" size="10" style="display: none;" />&nbsp;店铺名 &nbsp;
    <input type="text" name="shop_name" />
    &nbsp;店员名 &nbsp;
    <input type="text" name="waiter_name" />
    <input type="submit" value="<?php echo $this->_var['lang']['button_search']; ?>" />
  </form>
</div>

<form method="POST" action="" name="listForm" onsubmit="return confirm_bath()">

<!-- start users list -->
<div class="list-div" id="listDiv">
<?php endif; ?>
<!--用户列表部分-->
<table cellpadding="3" cellspacing="1">
  <tr>
    <th>
      <input onclick='listTable.selectAll(this, "checkboxes")' type="checkbox" style="display: none;">
      <a href="javascript:listTable.sort('id');"><?php echo $this->_var['lang']['record_id']; ?></a><?php echo $this->_var['sort_id']; ?>
    </th>
    <th>用户</th>
    <th>营业员</th>
    <th>商家</th>
    <th><a href="javascript:listTable.sort('money_paid');">金额</a><?php echo $this->_var['sort_money_paid']; ?></th>
    <th><a href="javascript:listTable.sort('id');">时间</a><?php echo $this->_var['sort_id']; ?></th>
  <tr>
  <?php $_from = $this->_var['sales_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'list');if (count($_from)):
    foreach ($_from AS $this->_var['list']):
?>
  <tr>
    <td align="center" width="16%"><?php echo $this->_var['list']['id']; ?></td>
    <td align="center" width="16%"><?php echo $this->_var['list']['user_name']; ?></td>
    <td align="center" width="16%"><?php echo $this->_var['list']['waiter_name']; ?></td>
    <td align="center" width="16%"><?php echo $this->_var['list']['shop_name']; ?></td>
    <td align="center" width="16%"><?php echo $this->_var['list']['money_paid']; ?></td>
    <td align="center" width="16%"><?php echo $this->_var['list']['add_time_format']; ?></td>
  </tr>
  <?php endforeach; else: ?>
  <tr><td class="no-records" colspan="10"><?php echo $this->_var['lang']['no_records']; ?></td></tr>
  <?php endif; unset($_from); ?><?php $this->pop_vars();; ?>
  <tr>
      <td colspan="2" style="display: none;">
      <input type="hidden" name="act" value="batch_remove" />
      <input type="submit" id="btnSubmit" value="<?php echo $this->_var['lang']['button_remove']; ?>" disabled="true" class="button" /></td>
      <td align="right" nowrap="true" colspan="8">
      <?php echo $this->fetch('page.htm'); ?>
      </td>
  </tr>
</table>

<?php if ($this->_var['full_page']): ?>
</div>
<!-- end users list -->
</form>
<script type="text/javascript" language="JavaScript">
<!--
listTable.recordCount = <?php echo $this->_var['record_count']; ?>;
listTable.pageCount = <?php echo $this->_var['page_count']; ?>;

<?php $_from = $this->_var['filter']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['item']):
?>
listTable.filter.<?php echo $this->_var['key']; ?> = '<?php echo $this->_var['item']; ?>';
<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>


onload = function()
{
    document.forms['searchForm'].elements['shop_name'].focus();
    // 开始检查订单
    startCheckOrder();
}

/**
 * 搜索用户
 */
function searchUser()
{
    listTable.filter['shop_name'] = Utils.trim(document.forms['searchForm'].elements['shop_name'].value);
    listTable.filter['waiter_name'] = Utils.trim(document.forms['searchForm'].elements['waiter_name'].value);
    listTable.filter['rank'] = document.forms['searchForm'].elements['user_rank'].value;
    listTable.filter['pay_points_gt'] = Utils.trim(document.forms['searchForm'].elements['pay_points_gt'].value);
    listTable.filter['pay_points_lt'] = Utils.trim(document.forms['searchForm'].elements['pay_points_lt'].value);
    listTable.filter['page'] = 1;
    listTable.loadList();
}

function confirm_bath()
{
  userItems = document.getElementsByName('checkboxes[]');

  cfm = '<?php echo $this->_var['lang']['list_remove_confirm']; ?>';

  for (i=0; userItems[i]; i++)
  {
    if (userItems[i].checked && userItems[i].notice == 1)
    {
      cfm = '<?php echo $this->_var['lang']['list_still_accounts']; ?>' + '<?php echo $this->_var['lang']['list_remove_confirm']; ?>';
      break;
    }
  }

  return confirm(cfm);
}
//-->
</script>

<?php echo $this->fetch('pagefooter.htm'); ?>
<?php endif; ?>